Skip to content

Attempt to simplify the token cache providers #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 4, 2019

Conversation

jmprieur
Copy link
Contributor

@jmprieur jmprieur commented Sep 3, 2019

DO NOT MERGE yet (until Expose IsApplicationTokenCache #1448) is released in MSAL.NET

Ideally we'd want the implementation of the token cache
providers to be simplified. This is not yet possible because the MSAL Abstract token cache provider contained a boolean telling if the token cache is an app or user token cache (so that the key
can be computed).

Now the TokenCacheEventArgs bring this boolean.

This PR simplifies the code a lot.

DO NOT MERGE

Ideally we'd want the implementation of the token cache
providers to be simplified. However this is not yet possible
because the MSAL Abstract token cache provider contains a boolean telling
if the token cache is an app or user token cache (so that the key
can be computed).

Ideally we'd want the ITokenCache to tell the application if it's an app token cache or a user token cache.
@@ -57,6 +57,6 @@
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureADB2C.UI" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.3.1" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.5.1-internal20191022.1isappcache" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Experimental. Contains PR AzureAD/microsoft-authentication-library-for-dotnet#1448, which not yet merged

@jmprieur
Copy link
Contributor Author

cc: @bgavrilMS @jennyf19 @henrik-me

@kalyankrishna1 @TiagoBrenck : if you want the MSAL.NET bits that work for this PR, see the artifacts of this build

@@ -111,13 +102,29 @@ protected virtual Task OnBeforeWriteAsync(TokenCacheNotificationArgs args)

public async Task ClearAsync()
{
await RemoveKeyAsync(CacheKey).ConfigureAwait(false);
// This is here a user token cache
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is here a user token cache [](start = 15, length = 31)

nit. "This is a user token cache"

@@ -22,37 +20,6 @@ public static class SqlTokenCacheProviderExtension
public static IServiceCollection AddSqlTokenCaches(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can this be singular? All the others are singular (i think)...ex AddSqlTokenCache

Copy link
Contributor

@jennyf19 jennyf19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@jmprieur jmprieur removed the do not merge PR not ready to merge yet label Nov 4, 2019
@jmprieur jmprieur merged commit feb0a2e into master Nov 4, 2019
@jmprieur jmprieur deleted the jmprieur/SimplifyTokenCacheProviders branch November 7, 2019 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants